package com.six.goods.controller.api;

import com.six.core.entity.Goods;
import com.six.core.vo.GoodsNumUpdateVo;
import com.six.core.vo.Result;
import com.six.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: WangPeng
 * @createTime: 2023/03/07 19:57
 * @description:
 * @version: v1.0
 */
@RestController
@RequestMapping("/goods/api/goods")
public class ApiGoodsController {
    @Autowired
    private GoodsService goodsService;

    @PostMapping("/updateGoodsNum")
    public Integer updateGoodsNum(@RequestBody List<GoodsNumUpdateVo> goodsList){
        return goodsService.updateGoodsNum(goodsList);
    }

    //根据id查询商品所有信息
    @PostMapping("/selectGoodsByid/{id}")
    @ResponseBody
    public Goods selectGoodsByid(@PathVariable Integer id){
        return goodsService.goodsbyid(id);
    }
}
